package org.demo.controller;

import org.demo.common.Result;
import org.demo.entity.Housewear;
import org.demo.service.IHousewearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//局势类型
@RestController
@RequestMapping("/housewear")
public class HousewearConteoller {
    @Autowired
    private IHousewearService housewearService;
    @PostMapping("/add")
    public Result add(@RequestBody Housewear housewear){
        housewearService.add(housewear);
        return Result.success();
    }
    @GetMapping("/list")
    public Result<List<Housewear>> list(@RequestBody (required = false) Housewear housewear){
        List<Housewear> pb= housewearService.list(housewear);
        return Result.success(pb);
    }
    @PutMapping("/update")
    public Result update(@RequestBody Housewear housewear){
        housewearService.update(housewear);
        return Result.success();
    }
    @DeleteMapping("/delete")
    public  Result delete(String id){
        housewearService.delete(id);
        return Result.success();
    }

}
